package com.ma.netana.dao;

import com.sun.org.apache.bcel.internal.generic.DUP;
import jpcap.JpcapCaptor;
import jpcap.NetworkInterface;
import jpcap.packet.*;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;
import com.ma.netana.utils.*;

import java.io.IOException;


//mongodb databases
@Component
@Repository
public class PacketDao {
    @Autowired
    private MongoTemplate mongoTemplate;

    IPAna ipAna = new IPAna();
    ARPAna arpAna = new ARPAna();
    ICMPAna icmpAna = new ICMPAna();
    UDPAna udpAna = new UDPAna();

    public void savePacket(IPPacket ipPacket){
        mongoTemplate.save(ipPacket);
    }

    public Object getIPPacket(){
        IPPacket ipPacket = ipAna.ipAna();
        return ipPacket;
    }

    public Object getARPPAcket(){
        ARPPacket arpPacket = arpAna.arpAna();

        return arpPacket;
    }

    public Object getICMPPAcket(){
        ICMPPacket icmpPacket = icmpAna.icmpAna();
        return icmpPacket;
    }

    public Object getUDPPAcket(){
        UDPPacket udpPacket = udpAna.udpAna();
        return udpPacket;
    }
}
